define(['./../../initial'],
    function() {
        var app = angular.module('App.home');
        app.controller('user.readonlyCtrl', ['$scope', '$rootScope', '$state', '$stateParams', 'User', 'showMsg',
            function($scope, $rootScope, $state, $stateParams, User, showMsg) {
                $scope.updateInfo = function() {
                    if ($scope.phone && $scope.mail) {
                        var user = new User();
                        user.postUpdateInfo({
                            phone: $scope.phone,
                            mail: $scope.mail
                        }).then(function(data) {
                            if (data.toString() === "true") {
                                showMsg('更新成功!', "info");
                            } else {
                                showMsg('发生错误!', "alert");
                            }
                        });
                    } else {
                        showMsg('信息填写不完整!', "alert");
                    }
                };
            }
        ]);
    });
